<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="pg" uri="http://jsptags.com/tags/navigation/pager" %>
<%@ taglib prefix="sf" uri="http://www.springframework.org/tags/form" %>

<%--
  Created by IntelliJ IDEA.
  User: 15c
  Date: 2017/6/8
  Time: 20:51
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title></title>
</head>
<body>
<jsp:include page="head.jsp"/>
<br>
<div style="width:100%;height: auto;text-align: center;margin-top: 1%">
  <div>
    <sf:form method="get" action="${pageContext.request.contextPath}/students/retrieval">
      <input type="text" name="keyword"/>
      <input type="submit" value="检索"/>
    </sf:form>
  </div>
  <table border="5" cellpadding="4" cellspacing="3" align="center">
    <thead>
    <tr>
      <th>学号</th>
      <th>姓名</th>
      <th>性别</th>
      <th>年龄</th>
      <th>系别</th>
      <th>身份证号</th>
      <th>联系方式</th>
      <th>家庭住址</th>
      <th>执行操作</th>
    </tr>
    </thead>
    <tbody>
    <c:forEach items="${pager.datas}" var="student">
      <tr>
        <td>${student.sno}</td>
        <td>${student.sname}</td>
        <td>${student.ssex} </td>
        <td>${student.sage}</td>
        <td>${student.sdept}</td>
        <td>${student.sid}</td>
        <td>${student.stelephonenum}</td>
        <td>${student.saddress}</td>
        <td>
          <div style="background-color:#aa001b;float: left ;cursor:pointer;text-align: center"><a
                  href="${pageContext.request.contextPath}/students/delete?sno=${student.sno}"
                  style="font-size: 14px;color: #fff">删除</a></div>
          <div style="margin-left: 5px;background-color:#1648aa;float: left ;cursor:pointer;text-align: center"><a
                  href="${pageContext.request.contextPath}/students/update?sno=${student.sno}"
                  style="font-size: 14px;color: #fff">更新</a></div>
          <div style="margin-left: 5px;background-color:#ddb413;float: right ;cursor:pointer;text-align: center"><a
                  href="${pageContext.request.contextPath}/students/view_results?sno=${student.sno}&sname=${student.sname}"
                  style="font-size: 14px;color: #fff">查看成绩</a></div>
        </td>
      </tr>
    </c:forEach>
    </tbody>
    <tr>
      <td colspan="9" align="center">
        <%--<jsp:include page="/WEB-INF/jsp/student/student_retrieval_pager.jsp">--%>
          <%--<jsp:param name="url" value="retrieval"/>--%>
          <%--<jsp:param name="items" value="${pager.totalRecord}"/>--%>
          <%--<jsp:param name="totalPage" value="${pager.totalPage}"/>--%>
          <%--<jsp:param name="maxPageItems" value="${pager.pageSize}"/>--%>
          <%--<jsp:param name="keyword" value="${keyword}"/>--%>
        <%--</jsp:include>--%>

          <pg:pager items="${pager.totalRecord}" maxPageItems="${pager.pageSize}" url="retrieval" maxIndexPages="10" export="curPage=pageNumber">
            共有<span style="color: red">${pager.totalPage}</span>页 当前是第<span style="color: red"><%=curPage%></span>页
            <%--<pg:param name="keyword" value="${keyword}"/>--%>
            <pg:first>
              <a href="${pageUrl}&keyword=${keyword}">首页</a>
            </pg:first>
            <pg:prev>
              <a href="${pageUrl}&keyword=${keyword}">上一页</a>
            </pg:prev>
            <pg:pages>
              <c:if test="${curPage eq  pageNumber}">
                [<span style="color: red;font-weight: bold"><%=pageNumber%></span>]
              </c:if>
              <c:if test="${curPage ne pageNumber}">
                <a href="${pageUrl}&keyword=${keyword}">${pageNumber}
                </a>
              </c:if>
            </pg:pages>
            <pg:next>
              <a href="${pageUrl}&keyword=${keyword}">下一页</a>
            </pg:next>
            <pg:last>
              <a href="${pageUrl}&keyword=${keyword}">尾页</a>
            </pg:last>
          </pg:pager>
      </td>
    </tr>
  </table>
</div>
</body>
</html>
